import request from '@/utils/request'

/**
 *查询列表
 * @param deptId
 */
export function getTableListApi(deptId) {
  return request({
    url: `/leaderConfig/list`,
    method: 'GET',
    params:{
      deptId
    },
  })
}



/**
 *查询项目
 * @param projectName
 */
export function getProjectListApi(projectName) {
  return request({
    url: '/pigfarm-project/like',
    method: 'get',
    params:{
      projectName
    },
  })
}


/**
 *查询详情
 * @param id
 */
export function getDetailInfoApi(id) {
  return request({
    url: `/leaderConfig/getById/${id}`,
    method: 'get',
  })
}

/**
 *暂存 && 编辑
 * @param type 1新增  2修改
 * @param data
 */
export function addAndUpdateApi(type,data) {
  let url = "";
  if(type==='add'){
    url = '/leaderConfig/insert';
  }else if(type==="edit"){
    url = '/leaderConfig/edit';
  }
  return request({
    url,
    method: 'POST',
    data,
  })
}

/**
 *删除
 * @param id
 */
export function deleteApi(id) {
  return request({
    url: `/leaderConfig/delete/${id}`,
    method: 'POST',
  })
}
